package com.x.erp.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.manage.CarOutManage;
import com.x.erp.model.CarOut;
import com.x.erp.rpc.CarOutRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
/**
 * 车辆临时出库服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.CarOutRpcService", timeout = 60000)
public class CarOutService extends BaseService implements CarOutRpcService {

	@Autowired
	private CarOutManage carOutManage; // 车辆临时出场manage
	
	@Override
	public void sendMsgCarOutOvertimeTask(CarOut carOut) {
		// 查询出出场时间大于5小时的临时出场车辆信息
		carOut = new CarOut();
		//当前时间减去5小时的毫秒数
		long timeMillis = System.currentTimeMillis() - 5 * 60 * 60 * 1000;
		carOut.setCarSiteTime(new Date(timeMillis));
		try {
			carOutManage.sendMsgCarOutOvertimeTask(carOut);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
